<html style="font-size: 50px;"><head>
    <title>爱"宇"你By U</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,target-densitydpi=device-dpi,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <link rel="stylesheet" href="weui.css">
    <link rel="stylesheet" href="common.css">
 
    </head><body>
  <div class="box_form">

  <div class="address_box">

    <div class="province">省份</div> 
        <div class="province_box">
                                
          
          <i class="select_icon"></i></div></div> <div class="address_box"><div class="city">城市</div> 
           
                   <div class="city_box">       
                   
                   <i class="select_icon"></i></div></div> <i class="tip2"></i> <div class="yuyue"><i class="yuyue_info yuyue1"></i> <i class="yuyue_info yuyue2"></i> <i class="yuyue_info yuyue3"></i>
                   </div>
                 </div>

          
          </div>
 </div>
 <script src="citydata.js"></script>
<script src="weui.min.js"></script>
<script type="text/javascript">
  var _province='';
  var _city='';
 var depth=2;
 var e=1;
 console.log(cityData);
 var _cityData=[];
 for (var i=0;i<cityData.length;i++) {
     //console.log(cityData[i].children);
     cityData[i].value=cityData[i].label;

     for (var j = 0; j< cityData[i].children.length; j++ ) {
          cityData[i].children[j].value=cityData[i].children[j].label;
     }
     

 }
  console.log(cityData);

          weui.picker(cityData, {
            depth: depth,
            className: 'picker',
            
            defaultValue: ['广东','深圳市'],
            onChange: function (result) {
              // console.log(result);
            },
            onConfirm: function (result) {
               console.log('result: ', result);

               var html = "";
              for (var i = 0; i < depth; i++) {
                // console.log(result[i]);
                if (i < depth - 1) {
                  html += result[i].label + "-";
                  _province = result[i].label;
                  if (e == 2) {
                    _province = result[i].label;
                  }
                } else {
                  html += result[i].label;
                  _city = result[i].label;
                  if (e == 2) {
                    _city = result[i].label;
                    
                  }
                }
              }//edn for
              console.log(_province);
              console.log(_city);
               
            },
            id: 'cityPicker'
          });
         
    


</script>


</body></html>